home *** CD-ROM | disk | FTP | other *** search
- unit staffobj;
-
- {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
- { Unit as part of the illustration of Virtual Methods. }
- { }
- { STAFFOBJ.PAS -> STAFFOBJ.TPU R. Shaw 26.4.91 }
- {_____________________________________________________________________}
-
- interface
-
- uses Crt;
-
- type
-
- staff = object
- Name : string;
- constructor Init(SurName : string );
- procedure script1; virtual; {virtual procedures which are }
- procedure script2; virtual; {overridden in the object junior}
- procedure action1; {static procedures which are inherited}
- procedure action2; {by the descendant object junior. }
- end;
-
- var
- LetterName : string;
-
-
- implementation
-
- constructor staff.Init( SurName : string );
- begin
- Name := SurName;
- end;
-
- procedure staff.script1;
- begin
- writeln( Name,
- ': Please send the duplicated letters to all our customers.');
- writeln( ' If you have a problem, please ask me.');
- end;
-
- procedure staff.script2;
- begin
- LetterName := 'OD';
- writeln(Name,': The letter is headed ',LetterName,'.');
- writeln;
- end;
-
- procedure staff.action1;
- begin
- script1;
- end;
-
- procedure staff.action2;
- begin
- script2;
- end;
-
- end.
-
- { end of listing }